# -*- coding=utf-8 -*-

def getNext(str):
    j,ls = 0,len(str)
    nxt = [0]*(ls+1)
    for i in range(1,ls):
        while j>0 and str[i]!=str[j] :
            j = nxt[j]
        if str[i]==str[j] :
            j += 1
        nxt[i+1] = j
    return nxt

def kmp(s1,s2):
    nxt = getNext(s2)
    j,l1,l2,res = 0,len(s1),len(s2),[]
    for i in range(l1) :
        while j>0 and s1[i]!=s2[j] :
            j = nxt[j]
        if s1[i]==s2[j] :
            j += 1
        if j>=l2 :
            res.append(i-j+1)
            j = nxt[j] 
    return res

def main():
    s1 = raw_input()
    s2 = raw_input()
    res = kmp(s1,s2)
    print res

if __name__=='__main__' :
    main()
